package main

import (
	"layouts/http/rest"
	"layouts/http/rpc"
	"os"
)

func main() {
	f, err := os.OpenFile("./http", os.O_RDONLY, 0755)
	if err != nil {
		panic(err)
	}
	dirs, err := f.Readdirnames(-1)
	if err != nil {
		panic(err)
	}
	for _, serverType := range dirs {
		startServer(serverType)
	}

}

func startServer(serverType string) {
	switch serverType {
	case "rest":
		rest.Start()
	case "rpc":
		rpc.Start()
	}
}
